package com.boe.config.spring;


import com.boe.config.interceptor.controller.DefaultMvcInterceptor;
import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
public class MvcWebConfig implements WebMvcConfigurer {

    private static Logger logger = LoggerFactory.getLogger(MvcWebConfig.class);


    @NotNull
    DefaultMvcInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor)
                .order(-5)
                .addPathPatterns("/*")
                .addPathPatterns("/**");
    }
}